/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.aacorps.javaeal.service.user;

import edu.aacorps.javaeal.common.UserDTO;
import edu.aacorps.javaeal.remote.UserServiceRemote;
import edu.aacorps.javaeal.repository.user.UserRepository;
import javax.ejb.DependsOn;
import javax.ejb.EJB;
import javax.ejb.Stateless;

/**
 *
 * @author anti
 */
@Stateless
//@Stateless (name = "AuthorService", mappedName = "ejb/AuthorService")
@DependsOn ({"UserRepository"})
public class UserServiceBean implements UserServiceRemote {

    @EJB
    private UserRepository userRepository;
    
    @Override
    public void registerUser(UserDTO userDTO) {
        if (userRepository.find(userDTO.getUserName()) == null) {
            userRepository.create(userRepository.toUserEntity(userDTO));
        }        
    }

    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
    
}
